<template>
  <div>
    <el-button type="primary" @click="willAdd">添加</el-button>
    <list-vue @willUpdate="willUpdate" :arr="arr" @init="getlist"></list-vue>
    <form-vue :info="info" @init="getlist" ref="form"></form-vue>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import listVue from "./components/list.vue";
import formVue from "./components/form.vue";
import { reqrolelist } from "../../http/api";
import { toggle } from '../../mixins';
export default {
  components: {
    listVue,
    formVue
  },
  mixins:[toggle],
  data() {
    return {
      arr:[],
    };
  },
  computed: {
    ...mapGetters({})
  },
  mounted() {
    this.getlist();
  },
  methods: {
    ...mapActions({}),
    getlist() {
      reqrolelist().then(res => {
        if (res.data.code == 200) {
          this.arr = res.data.list ? res.data.list : [];
        }
      });
    }
  }
};
</script>
<style scoped lang='less'>
@import "../../less/index.less";
</style>